import { setToken, getToken, removeToken } from '@/utils/storage'

const state = {
  tokenInfo: getToken()
}
const mutations = {
  setTokenInfo(state, newTokenInfo) {
    state.tokenInfo = newTokenInfo
    setToken(newTokenInfo)
  },
  removeTokenInfo(state) {
    state.tokenInfo = {}
    // 更新本地, 本地清掉token信息
    removeToken()
  }
}
const actions = {}
const getters = {}
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
